<?php
namespace Common\Common;
require_once('./Application/Common/Common/PHPMailer/class.phpmailer.php');
class EmailControl{

private $user_name;
private $user_pwd;

public function __construct($user_name,$user_pwd){
$this->user_name=$user_name?$user_name:C('group_email');
$this->user_pwd=$user_pwd?$user_pwd:C('group_email_pwd');
}

public function send($send_to,$send_subject,$send_content){
    //Author:Jiucool WebSite: http://www.jiucool.com 
    //$to 表示收件人地址 $subject 表示邮件标题 $body表示邮件正文
	 //echo "324324";exit;
     //error_reporting(E_STRICT);
	error_reporting(0);
    date_default_timezone_set("Asia/Shanghai");//设定时区东八区
 
    $mail             = new /
		PHPMailer(); //new一个PHPMailer对象出来
    $body             = eregi_replace("[\]",'',$send_content); //对邮件内容进行必要的过滤
    $mail->CharSet ="UTF-8";//设定邮件编码，默认ISO-8859-1，如果发中文此项必须设置，否则乱码
    $mail->IsSMTP(); // 设定使用SMTP服务
    $mail->SMTPDebug  = 1;                     // 启用SMTP调试功能
                                           // 1 = errors and messages
                                           // 2 = messages only
    $mail->SMTPAuth   = true;                  // 启用 SMTP 验证功能
    $mail->SMTPSecure = "ssl";                 // 安全协议
    $mail->Host       = "smtp.exmail.qq.com";      // SMTP 服务器
    $mail->Port       = 465;                   // SMTP服务器的端口号
	
    $mail->Username   = $this->user_name;  // SMTP服务器用户名
    $mail->Password   = $this->user_pwd;            // SMTP服务器密码   
	$mail->SetFrom($this->user_name, C('WEB_TITILE'));
    $mail->AddReplyTo($this->user_name,C('WEB_TITILE'));

    $mail->Subject    = $send_subject;
    //$mail->AltBody    = "To view the message, please use an HTML compatible email viewer."; // optional, comment out and test
    $mail->MsgHTML($send_content);
    $mail->AddAddress($send_to, "No reply");
	//$mail->Send();
	//echo $mail->ErrorInfo;exit;
   
	if(!$mail->Send())
	  return false;
    else
      return true;
	  
}

}
?>